package org.carl.dual.asyn;

import java.util.ArrayList;
import java.util.List;

import org.carl.dual.ThreadHelper;

public class NoReturn {
	class Run1 implements Runnable {
		@Override
		public void run() {
		}

	}

	public static void main(String[] args) {
		List<Runnable> runnables = new ArrayList<>();
		long start = System.currentTimeMillis();
		runnables.add(() -> {
			try {
				Thread.sleep(10000);
				System.out.println(Thread.currentThread().getName() + " task1 is end!");
			} catch (Exception e) {
				e.printStackTrace();
			}
		});
		runnables.add(() -> {
			try {
				Thread.sleep(5000);
				System.out.println(Thread.currentThread().getName() + " task2 is end!");
			} catch (Exception e) {
				e.printStackTrace();
			}
		});
		runnables.add(() -> {
			try {
				Thread.sleep(8000);
				System.out.println(Thread.currentThread().getName() + " task3 is end!");
			} catch (Exception e) {
				e.printStackTrace();
			}
		});
		ThreadHelper.execute(runnables,true);
		long end = System.currentTimeMillis();
		System.out.println("耗时:" + (end - start));
	}
}
